(function localFileVideoPlayerInit(win) {
    var URL = win.URL || win.webkitURL,
        playSelectedFile = function playSelectedFileInit(event) {
            $("#vidError").hide();
            $("#video").show();
            var file = this.files[0];
            var type = file.type;
            var videoNode = $("#video")[0];
            var canPlay = videoNode.canPlayType(type);
            canPlay = (canPlay === '' ? 'no' : canPlay);
            //console.log( 'Can play type "' + type + '": ' + canPlay);
            var isError = canPlay === 'no';
            if (isError) {
                $("#video").hide();
                $("#vidError").show();
                return;}
            var fileURL = URL.createObjectURL(file);
            videoNode.src = fileURL;
        },
        inputNode = $("#vidInput")[0];
        if (!URL) {
             $("#video").text('Your browser is not  supported!', true);
        return;
        }
    inputNode.addEventListener('change', playSelectedFile, false);
}(window));
